1. Field of the Invention
This invention relates to computer processes and, more particularly, to managing the profiling of processes.
2. Description of the Related Art
In order to gain a fuller understanding of the operation of software processes, it is common to employ any of a variety of monitoring, profiling, and/or analysis programs in conjunction with the software processes to be understood. Such monitoring, profiling, and analysis programs which, for simplicity, may collectively be referred to as “profilers”, are available from many vendors or may be custom-made for specific applications. It is generally desirable to be able to profile selected processes as well as to select specific profilers to operate with selected processes. Therefore, some mechanism for identifying processes and profilers and associating one with the other may be desired. Existing operating system software may provide environment variables through which profiling and profiling processes may be specified. However, each process may have its own individually set environment variables, the values of which may be determined by the process itself or a parent process from which the profiled process is launched. Since the profiled process and the profiler may be written by different programmers or come from different vendors, the environment variable settings of any given process may not conform to the settings desired by the profiler.
For example, software systems such as Microsoft's .NET® framework and Windows® operating system may enable programs and processes to provide dynamic and interactive web pages such as Active Server Pages (ASP). As applications and processes based on .NET technology proliferate, the desire to monitor and profile the operation of these applications and processes has increased. The .NET framework includes a profiling Application Program Interface (API) which allows application programmers to write an application (e.g., a “profiler”) that can monitor the operation of applications running within the .NET framework. Such a profiler may monitor resource usage, interactions between processes and the operating system or the .NET framework, exception handling, etc.
To enable a profiler to monitor a process, the .NET profiling API uses environment variables (sometimes referred to as “envars”) that are provided by the underlying operating system. One environment variable, COR_ENABLE_PROFILING may be used to determine whether profiling is enabled. A second environment variable, COR_PROFILER may be used to specify a particular profiler to be used. The values of these environment variables at the time the process is launched determine if and how the process will be profiled. In the case of applications for which the source code is readily available and may be modified, the program may set the environment variables itself. However, in many cases it is difficult to change the environment variables between process launches. For example, a system reboot may be required to have new environment variable settings take effect if the process is a system service. Also, the source code for a given application (e.g., third party applications) may not be available. Consequently, it may not be possible, or practical, to modify an application to set particular environment variables.
Consequently, a method and mechanism for managing the environment variables and the profiling of processes is desired.